package com.aspose.cells.a.d;

public class zdv extends zds {
   public zdv(com.aspose.cells.b.a.d.zm var1) {
      super(var1);
   }

   public void b(byte[] var1, int var2, int var3) throws Exception {
      boolean var4 = false;
      byte[] var5 = new byte[-128];
      byte var6 = 0;
      byte var7 = 0;
      byte var8 = 0;
      byte var9 = 0;

      for(int var10 = 0; var10 < var3; ++var10) {
         int var11 = var2 + var10;
         if (var9 != 0) {
            var7 = var1[var11];
            var8 = var1[var11 - 1];
         }

         switch(var9) {
         case 0:
            var9 = 1;
            break;
         case 1:
            if (var7 == var8) {
               var9 = 3;
               var6 = 2;
            } else {
               var9 = 2;
               var5[0] = var8;
               var6 = 1;
            }
            break;
         case 2:
            if (var7 == var8) {
               this.a(var5, var6 & 255);
               var9 = 3;
               var6 = 2;
            } else {
               var5[var6 & 255] = var8;
               ++var6;
               if (var6 == -128) {
                  this.a(var5, var6 & 255);
                  var9 = 1;
               }
            }
            break;
         case 3:
            if (var7 != var8) {
               this.a(var8, var6 & 255);
               var9 = 1;
            } else {
               ++var6;
               if (var6 == -128) {
                  this.a(var7, var6 & 255);
                  var9 = 1;
               }
            }
            break;
         default:
            throw new IllegalStateException("Unknown RLE state.");
         }
      }

      switch(var9) {
      case 2:
         var5[var6 & 255] = var7;
         this.a(var5, (var6 & 255) + 1);
         break;
      case 3:
         this.a(var7, (var6 & 255) + 1);
         break;
      default:
         throw new IllegalStateException("Unknown RLE state.");
      }

      this.a.a((byte)-128);
   }

   private void a(byte[] var1, int var2) throws Exception {
      assert var2 >= 1 && var2 <= 128;

      this.a.a((byte)(var2 - 1));
      this.a.b(var1, 0, var2);
   }

   private void a(byte var1, int var2) throws Exception {
      assert var2 >= 2 && var2 <= 128;

      this.a.a((byte)(257 - var2));
      this.a.a(var1);
   }

   public void a() throws Exception {
      super.a();
   }
}
